package com.qinggeng.project.system.mapper;

import com.qinggeng.project.system.domain.SinglePointSale;
import com.qinggeng.project.system.domain.vo.SinglePointSaleVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.special.InsertListMapper;

import java.util.Date;
import java.util.List;


public interface SinglePointSaleMapper extends Mapper<SinglePointSale>, InsertListMapper<SinglePointSale> {

    /**
     * 查询配送区域单个自提点销量
     *
     * @param id 配送区域单个自提点销量ID
     * @return 配送区域单个自提点销量
     */
    public SinglePointSale getSinglePointSaleById(Long id);


    /**
     * 根据配送点Id、商品ID和记录日期查询销量
     * @return
     */
    SinglePointSale getSinglePointSaleByPointIdAndGoodsIdAndRecordDate(@Param("pointId") Long pointId, @Param("goodsId") Long goodsId, @Param("recordDate") String recordDate);


    SinglePointSale getSinglePointSaleByPointIdAndGiftIdAndRecordDate(@Param("pointId") Long pointId, @Param("giftId") Long giftId, @Param("recordDate") String recordDate);
    /**
     * 查询配送区域单个自提点销量列表
     *
     * @param singlePointSale 配送区域单个自提点销量
     * @return 配送区域单个自提点销量集合
     */
    public List<SinglePointSale> listSinglePointSale(SinglePointSale singlePointSale);

    List<SinglePointSale> listSinglePointSaleByTime(SinglePointSale where);

    /**
     * 新增配送区域单个自提点销量
     *
     * @param singlePointSale 配送区域单个自提点销量
     * @return 结果
     */
    public int insertSinglePointSale(SinglePointSale singlePointSale);

    /**
     * 增加销量
     * @param
     * @param
     * @return
     */
    boolean addSinglePointSaleNum(SinglePointSale singlePointSale);

    /**
     * 减去销量
     * @param
     * @param
     * @return
     */
    int subtractSinglePointSaleNum(SinglePointSale singlePointSale);

    /**
     * 修改配送区域单个自提点销量
     *
     * @param singlePointSale 配送区域单个自提点销量
     * @return 结果
     */
    public int updateSinglePointSale(SinglePointSale singlePointSale);

    /**
     * 删除配送区域单个自提点销量
     *
     * @param id 配送区域单个自提点销量ID
     * @return 结果
     */
    public int deleteSinglePointSaleById(Long id);

    /**
     * 批量删除配送区域单个自提点销量
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteSinglePointSaleByIds(Long[] ids);

    /**
     * 查询昨天的单自提点销量
     * @return
     */
    List<SinglePointSaleVo> listSinglePointSaleByYesterday(@Param("pointId") Long pointId,@Param("recordDate")String recordDate);
    /**
     * 打印自提点销量
     * @param id
     * @return
     */
    int printSinglePointSaleList(Long id);


    int printSinglePointByIds(String id);
}
